package com.swm.util;

/**
 * @author 师文明
 * @data 2024/12/12 下午3:28
 **/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class AjaxClient {
    public static void main(String[] args) throws Exception {
        String urlString = "https://q.10jqka.com.cn/index/index/board/hs/field/zdf/order/desc/page/1/ajax/1/"; // 替换为你的AJAX接口URL
        URL url = new URL(urlString);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();

        // 设置请求方法，如果需要的话也可以添加请求头
        connection.setRequestMethod("GET");
        connection.setRequestProperty("Content-Type", "text/html; charset=gbk");
        connection.setRequestProperty("Cookie", "Hm_lvt_78c58f01938e4d85eaf619eae71b4ed1=1733728111; HMACCOUNT=A6843E6FD6924CBF; Hm_lvt_722143063e4892925903024537075d0d=1733732270; Hm_lvt_929f8b362150b1f77b477230541dbbc2=1733732270; spversion=20130314; u_ukey=A10702B8689642C6BE607730E11E6E4A; u_uver=1.0.0; u_dpass=Zhy4ygECWWRkk5x%2FcZDR6Utj8UtGRIFZa50SBlGedA3o7wIgrA%2FGPercOX74OFgmHi80LrSsTFH9a%2B6rtRvqGg%3D%3D; u_did=A76F7DE5D73E4D49BA017DE9649B3F86; u_ttype=WEB; user_status=0; ttype=WEB; user=MDpteF9sM3VkcTR6NDQ6Ok5vbmU6NTAwOjc2MjA0MDc5Nzo3LDExMTExMTExMTExLDQwOzQ0LDExLDQwOzYsMSw0MDs1LDEsNDA7MSwxMDEsNDA7MiwxLDQwOzMsMSw0MDs1LDEsNDA7OCwwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMSw0MDsxMDIsMSw0MDoxNjo6Ojc1MjA0MDc5NzoxNzMzOTc5NDY3Ojo6MTczMTY1OTcwMDo2MDQ4MDA6MDoxNmEzNjc5Nzc1MTcwZDdmMjlmOTViNTY5MjhlOGU0MmE6ZGVmYXVsdF80OjA%3D; userid=752040797; u_name=mx_l3udq4z44; escapename=mx_l3udq4z44; ticket=19a834c99a2d8126c790a0d506be7a6c; utk=954de76f26995e414c6216528179ae29; historystock=300403%7C*%7C002526%7C*%7C301076%7C*%7C000659%7C*%7C300694; Hm_lpvt_722143063e4892925903024537075d0d=1733988413; log=; Hm_lpvt_929f8b362150b1f77b477230541dbbc2=1733988414; Hm_lpvt_78c58f01938e4d85eaf619eae71b4ed1=1733988414; v=A-ACnJB8k3maMy99mhQyBpWVseW06cSzZs0Yt1rxrPuOVY7TAvmUQ7bd6Fqp");

        // 连接
        connection.connect();

        // 读取响应
        BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        String inputLine;
        StringBuilder content = new StringBuilder();
        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }
        in.close();

        // 断开连接
        connection.disconnect();

        // 打印结果
        System.out.println(content.toString());
    }
}
